﻿using System.Collections.Generic;
using System.Linq;
using Microsoft.Practices.Unity;
using Shop.Infrastructure.Containers;

namespace Shop.Core.Events
{
    /// <summary>
    /// 订阅服务
    /// </summary>
    public class SubscriptionService : ISubscriptionService
    {
        /// <summary>
        /// 返回T类型所有的消费者
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public IList<IConsumer<T>> GetSubscriptions<T>()
        {
            return Container.Current.ResolveAll<IConsumer<T>>().ToList();
        }
    }
}
